package com.abc.tacos.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.sql.DataSource;

/**
 * @author Kar
 * @version 1.0
 * @date 2022/4/16 16:00
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("home");
    }

    //@Bean
    //public DataSource dataSource() {
    //    return new EmbeddedDatabaseBuilder()
    //            .setType(EmbeddedDatabaseType.H2)
    //            .addScript("schema_test.sql")
    //            .addScripts("data_test.sql")
    //            .build();
    //}
}
